/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
<template>
    <sf-form ref="form"
             class="update-model__form"
             :label-width="140">
        <sf-form-item>
            <sf-fieldlabel>
                <lang>原任务名称</lang>
            </sf-fieldlabel>
            <span class="line-32">{{ submitData.name }}</span>
        </sf-form-item>
        <sf-form-item>
            <sf-fieldlabel>
                <lang>任务名称</lang>
            </sf-fieldlabel>
            <sf-textfield
                ref="fieldName"
                v-model="submitData.newName"
                :default-width="defaultWidth"
                :max-length="30"
                :allow-blank="false"
                :utf8-length="false"
                vtype="name"
                :blur-trim="true" />
        </sf-form-item>
        <sf-form-item class="form-item--first">
            <sf-fieldlabel>
                <lang>数据源时间</lang>
            </sf-fieldlabel>
            <sf-select v-model="submitData.dataField"
                       :default-width="defaultWidth"
                       :allow-search="true"
                       :allow-blank="false"
                       :placeholder="_('请选择时间字段')"
                       :options="timeFieldList" />
            <sf-fieldtip>
                <lang>选择具体某一个时间字段作为时间轴，设定具体的时间区间，从而对这段时间内的数据源进行训练。</lang>
            </sf-fieldtip>
        </sf-form-item>
        <sf-form-item class="form-item--first">
            <sf-fieldlabel>
                <lang>数据源取值范围</lang>
            </sf-fieldlabel>
            <sf-numberfield v-model="submitData.dataLength"
                            :default-width="100"
                            :allow-blank="false"
                            :allow-decimals="false"
                            :placeholder="_('请输入整数')"
                            :min-value="1" />
            <sf-select v-model="submitData.dataUnit"
                       :default-width="177"
                       :allow-search="true"
                       :allow-blank="false"
                       :options="timeUnitList" />
        </sf-form-item>
    </sf-form>
</template>
<script>

import {
    UPDATA_TIME_UNIT_LIST
} from 'src/home/mod_cluster/project_manager/feature_manager/const_data';

const DEFAULT_WIDTH = 280;
const DEFAULT_VALUE = {
    name: '',
    dataLength:1,
    dataUnit:'',
    newName:'',
    dataField:''
};
export default {
    computed: {
        defaultWidth () {
            return DEFAULT_WIDTH;
        },
        timeUnitList () {
            return UPDATA_TIME_UNIT_LIST;
        }
    },
    data () {
        return {
            submitData: { ...DEFAULT_VALUE },
            timeFieldList:[]
        };
    },
    mounted () {
    },
    methods: {
        getJsonValue () {
            return this.submitData;
        },

        setJsonValue (data) {
            this.submitData = Object.assign({ ...DEFAULT_VALUE }, data);
        }
    }
};
</script>
<style lang="less">
.update-model__form {
    .line-32{
        line-height: 32px;
    }
}
</style>
      